<template>
  <basic-dialog v-model="dialogVisible" :submitBtnLoading="submitLoading" title="'问题反馈详情'" width="1000"
                @cancel="handlerCancel" @close="handlerCancel" @submit="handleSubmit">
    <basic-crud ref="crudRef" :apiListParams="getParams"
                :fastSearch="{name:'计划编号、规程编号、项目号',fastColumn:'sourceCode,primaryTargetCode,code'}" :option="option"
                apiGetListUrl="/mes/mesWorkOrderController/listForProgress">
      <template #status="{ row }">
        <el-tag>{{ row.statusShow }}</el-tag>
      </template>
      <template #fileNames="{ row }">
        <el-button type="text" @click="viewFiles(row)">{{
            row.fileNames
          }}
        </el-button>
      </template>
    </basic-crud>
  </basic-dialog>
</template>

<script setup>
import {computed} from 'vue';
import {formatDate} from "../../../utils/formatTime";

const dialogVisible = ref(false);
const submitLoading = ref(false);
const getParams = computed(() => {
  return {
    id: parentRow.value.id,
    orderBy: parentRow.value.orderBy,
    orderMethod: parentRow.value.orderMethod,
  }
});
const option = ref({
  addBtn: false,
  cellBtn: true,
  editBtn: false,
  align: "center",
  menu: false,
  highlightCurrentRow: true,
  //index:true,
  searchShowBtn: true,
  height: "500px",
  searchMenuPosition: "right",
  searchMenuSpan: 6,
  searchShow: false,
  column: [
    {
      label: "状态",
      prop: "status",
      width: 80,
      slot: true,
      display: false,
      sortable: true,
      search: true,
      sortField: "status",
      searchType: 'select',
      dicData: [
        {
          label: "未处理",
          value: "Created",
        },
        {
          label: "已处理",
          value: "Released",
        },
      ],
      formatter: (val) => {
        return val.statusShow;
      }
    },
    {
      label: "编号",
      prop: "code",
      overHidden: true,
      minWidth: 100,
      display: false,
    },
    {
      label: '产品型号',
      prop: 'modelName',
      search: true,
      display: false,
      minWidth: 120,
    },
    {
      label: '产品名称',
      prop: 'productName',
      search: true,
      display: false,
      minWidth: 120,
    },
    {
      label: '产品编号',
      prop: 'productCode',
      search: true,
      display: false,
      minWidth: 120,
    },
    {
      label: "创建时间",
      prop: "proposeTime",
      overHidden: true,
      minWidth: 150,
      display: false,
      formatter: (row) => {
        return formatDate(row.proposeTime, "yyyy-MM-dd");
      },
      format: 'yyyy-MM-dd',
    },
    {
      label: "结束时间",
      prop: "zeroingTime",
      overHidden: true,
      minWidth: 100,
      display: false,
      formatter: (row) => {
        return formatDate(row.zeroingTime, "yyyy-MM-dd");
      },
      format: 'yyyy-MM-dd',
    },
    {
      label: '问题类型',
      prop: 'problemClassifysText',
      width: 180,
      display: false,
      overHidden: true,
      span: 24,
    },
    {
      label: "问题描述",
      prop: "problemDesc",
      overHidden: true,
      minWidth: 300,
      display: false,
    },
    {
      label: "解决方案",
      prop: "solution",
      overHidden: true,
      minWidth: 300,
      display: false,
    },
    {
      label: "附件",
      prop: "fileNames",
      slot: true,
      overHidden: true,
      minWidth: 300,
      display: false,
    },
  ]
});
const parentRow = ref({});
const openDialog = (type, row) => {
  dialogVisible.value = true;
  parentRow.value = row;
};
const viewFiles = (row) => {
  if (verifyNull(row) || verifyNull(row.id)) {
    ElMessage.error("请先点击行数据选中一条问题反馈单信息！");
    return false;
  }
}
const handlerCancel = () => {

};
const handleSubmit = () => {

};
</script>

<style lang="scss" scoped>

</style>
